#include <stdio.h>

//翻转，头尾互换
void reverse(int data[], int m, int n){
	int temp = 0;
	for(; m < n; m++, n--){
		temp = data[m];
		data[m] = data[n];
		data[n] = temp;
	}
}

int main()
{
	int length = 0, N = 0, i = 0;
	int data[100] = {0};
	printf("输入一个数组长度和移动个数: \n");
	scanf("%d %d", &length, &N);
	printf("请输入%d个数字\n", length);
	for(i = 0;i < length; i++){
		scanf("%d", &data[i]);
	}
	reverse(data, 0, length - N - 1);
	reverse(data, length - N, length - 1);
	reverse(data, 0, length - 1);
	for(i = 0; i < length - 1; i++){
		printf("%d ", data[i]);
	}
	printf("%d\n", data[i]);
	return 0;
}
